﻿using Best.SmartCms.Dto.Response;
using Best.SmartCms.Dto.Common;
using Best.SmartCms.Service.Common;
using Microsoft.AspNetCore.Mvc;

namespace Best.SmartCms.API.Controllers
{
    /// <summary>
    /// 站点配置
    /// </summary>
    public class SettingController : Controller
    {
        private readonly SiteSettingService _settingService;

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="settingService"></param>
        public SettingController(SiteSettingService settingService)
        {
            _settingService = settingService;
        }


        

        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("setting/edit")]
        public ApiResponse Edit([FromBody]SiteSettingDto dto)
        {
            _settingService.Edit(dto);
            return ApiResponse.Succeeds();
        }


        /// <summary>
        /// 详情
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        [Route("setting/Info")]
        public ApiResponse<SiteSettingDto> Info()
        {
            var ret = _settingService.Info();
            return ApiResponse<SiteSettingDto>.Succeeds(ret);
        }

    }
}